#include<stdio.h>
int main()
{
    long long a,b,c,d;
    char e,f,g,h,i,j;
    scanf("%ld",&a);
    scanf("%c",&e);
    scanf("%ld",&b);
    scanf("%c",&f);
    scanf("%c",&g);
    scanf("%c",&h);
    scanf("%c",&i);
    scanf("%c",&j);
    scanf("%ld",&c);
    d=c-b-1;
    printf("%ld",d);
    return 0;
}
